package com.neolix.watch.BroadcastReceiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.nfc.Tag;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;

import com.neolix.watch.NeolixApplication;
import com.neolix.watch.bluetooth.BlueToothUtil;
import com.neolix.watch.bluetooth.BluetoothLeService;
import com.neolix.watch.domain.NotificationType;
import com.neolix.watch.service.AudioPlayerService;
import com.neolix.watch.util.CommonHelper;
import com.neolix.watch.util.Constant;
import com.neolix.watch.util.SharedPreferencesUtil;

import static com.neolix.watch.NeolixApplication.getInstance;
import static com.neolix.watch.util.StringUtil.isBlank;
import static com.neolix.watch.util.StringUtil.isNotBlank;

public class WatchReceiver extends BroadcastReceiver {
    private String TAG = WatchReceiver.class.getSimpleName();

    @Override
    public void onReceive(Context context, Intent intent) {
        boolean isActived = false;
        if (intent.getAction().equals(Constant.WatchAction.ACTION_WATCH_READ_ACTIVATED)) {
            isActived = intent.getBooleanExtra(BluetoothLeService.EXTRA_DATA, false);
            Intent intent1 = new Intent(getInstance(), AudioPlayerService.class);
            if (isActived)
                getInstance().startService(intent1);
            else
                getInstance().stopService(intent1);
        }

        Log.d(TAG, "" + isActived);
    }
}
